package benlai_miniprogram;

import java.util.HashMap;
import java.util.Map;

/**
 * 3.1.0 去掉参数 deliverySysNo
 */
public class HttpGlobal {

    /**
     * 版本号
     */
    private static String version = "3.1.0";
    /**
     * 城市编号
     */
//    private static String deliverySysNo = "120";
    /**
     * 城市
     */
    private static String citySysNo = "120";
    /**
     * 站点
     */
    private static String webSiteSysNo = "3";
    /**
     * 缓存数据
     */
    private static Map<String,Object> storage = new HashMap <> ( );
    /**
     * 公告请求参数
     */
    private static Map<String,String> parameters = new HashMap <> ( );

    /**
     * 小程序接口链接
     */
    public static class Path {
        /**
         * http://192.168.60.33:10015
         */

        // 活动首页
        public static final String Home_GetHomePage="/Home/GetHomePage";

        //校验登录状态
        public static final String Account_CheckUser="/Account/CheckUser";

        /**
         * 用微信code登录，grant_type为wx_miniprogram
         * 获取客户端验证的access_token，grant_type为client_credentials
         * 在测试过程中，无法获取 微信code ， 小程序api在测试环境使用后门
         * 请求参数 code:benlaiTest|unionId ,encryptedData和iv 任意值
         * 注意：token 接口请求头 "Authorization"："Basic YmVubGFpX21pbmlwcm9ncmFtOjdhOTRmMTkwNjA5MzExZTdhNmYxNWZiMDlmNWY4Y2Yw"
         * 注意：token 接口的请求方式为 x-www-form-urlencoded ，不能使用 jsonBody 请求
         */
        public static final String Token="/Token";

        //绑定手机
        public static final String Account_BindPhone="/Account/BindPhone";

        //发送绑定手机号验证码短信
        public static final String Account_SendBindPhoneSMS="/Account/SendBindPhoneSMS";

        //我的红包
        public static final String Coupon_CouponList="/Coupon/CouponList";

        //领券首页
        public static final String Home_GetCouponHomePage="/Home/GetCouponHomePage";

        //登录领券接口
        public static final String CouponActivity_LoginBindCoupon="/CouponActivity/LoginBindCoupon";

        //获取七牛token
        public static final String IUserHome_GetQiNiuToken= "http://m.benlai.com/api/forward/IUserHome/GetQiNiuToken";

        //获取商品信息
        public static final String Product_Get="/Product/Details";

        //获取商品评论标签列表
        public static final String Comment_ProductCommentLabelList="/Comment/ProductCommentLabelList";

        //获取商品评论列表
        public static final String Comment_ProductCommentList="/Comment/ProductCommentList";

        //获取省市区列表
        public static final String Area_List="/Area/List";

        //四级街道信息
        public static final String Area_Street="/Area/Street";

        //获取收货地址列表
        public static final String Address_GetAddresses="/Address/GetAddresses";
        //收货地址新增或修改
        public static final String Address_UpdateAddress="/Address/UpdateAddress";
        //收货地址删除接口
        public static final String Address_DeleteAddress="/Address/DeleteAddress";

        //选择商品，数量接口
        public static final String Order_SelectProduct="/Order/SelectProduct";

        //订单检查接口
        public static final String Order_CheckOrder="/Order/CheckOrder";

        //订单列表
        public static final String Order_OrderList="/Order/OrderList";
        //选择地址
        public static final String Order_SelectAddress="/order/SelectAddress";

        //订单获取优惠券列表
        public static final String Order_LoadOrderCouponList="/order/LoadOrderCouponList";

        //订单使用优惠券
        public static final String Order_UseCoupon="/order/UseCoupon";

        //微信支付
        public static final String Pay_UnifiedGoPay="/Pay/UnifiedGoPay";

        //提交订单
        public static final String Order_CreateOrder="/Order/CreateOrder";

        //支付成功后绑券
        public static final String Pay_MiniOrderPaySuccess="/Pay/MiniOrderPaySuccess";
        //活动列表接口
        public static final String Home_GetHomePageList="/Home/GetHomePageList";

        //拉新红包活动状态
        public static final String CouponActivity_GetRedPacketVirus="/CouponActivity/RedPacketVirus";

        //分享拉新红包活动信息
        public static final String CouponActivity_ShareRedPacketVirus="/CouponActivity/ShareRedPacketVirus";

        //分享拉新红包活动领券
        public static final String CouponActivity_BindCoupon="/CouponActivity/ReceivingBenefits";

        //邀请好友拆红包活动信息
        public static final String CouponActivity_GetRedPacketInfo="/CouponActivity/RedBomb";

        //邀请好友拆红包活动信息
        public static final String CouponActivity_NewRedBomb="/CouponActivity/NewRedBomb";

        //绑好友拆红包
        public static final String CouponActivity_Demolition="/CouponActivity/Demolition";

        //拆红包领优惠券
        public static final String CouponActivity_Explode="/CouponActivity/Explode";

        //定位
        public static final String Location_Get="/Location/Get";

        //城市列表
        public static final String Area_CityList="/Area/CityList";

        //城市编号匹配省份
        public static final String Area_index="/Area";

        //新首页
        public static final String Home_index="/Home";

        //新活动页
        public static final String ActivityPage="/ActivityPage";

        //扫二维码进入, 获取商品列表
        public static final String ActivityPage_QR="/ActivityPage/QR";

        //获取二维码活动信息(线下推广)
        public static final String Activity_LoadQRPromotionInfo="/Activity/LoadQRPromotionInfo";

        //获取二维码活动信息(线上)
        public static final String QR_Load="/QR/Load";

        //新版拆红包活动
        public static final String LuckRedPacket="/LuckRedPacket";

        //新版拆红包活动 获取弹幕列表
        public static final String LuckRedPacket_WinnersList="/LuckRedPacket/WinnersList";

        //领取红包
        public static final String Reward="/LuckRedPacket/reward";
        //搜索
        public static final String Search="/Search";

        public static final String HotSearch="/Search/HotSearchKeys";

        //购物车
        public static final String Cart="/Cart";

        //购物车选择
        public static final String Cart_SeletedItem="/Cart/SeletedItem";

        //购物车取消选择
        public static final String Cart_CancelItem="/Cart/CancelItem";

        public static final String CartCount="/Cart/Count";

        public static final String CouponProduct="/Coupon/CanBuyProductLis";
    }

    public static String getVersion() {
        return version;
    }

    public static void setVersion(String version) {
        HttpGlobal.version = version;
        parameters.put ( "version", HttpGlobal.version );
    }

//    public static String getDeliverySysNo() {
//        return deliverySysNo;
//    }

//    public static void setDeliverySysNo(String deliverySysNo) {
//        HttpGlobal.deliverySysNo = deliverySysNo;
//        parameters.put ( "deliverySysNo", HttpGlobal.deliverySysNo );
//    }

    public static String getCitySysNo() {
        return citySysNo;
    }

    public static void setCitySysNo(String citySysNo) {
        HttpGlobal.citySysNo = citySysNo;
        parameters.put ( "citySysNo", HttpGlobal.citySysNo );
    }

    public static String getWebSiteSysNo() {
        return webSiteSysNo;
    }

    public static void setWebSiteSysNo(String webSiteSysNo) {
        HttpGlobal.webSiteSysNo = webSiteSysNo;
        parameters.put ( "webSiteSysNo", HttpGlobal.webSiteSysNo );
    }

    public static Object getStorage( String key) {
        return storage.get ( key );
    }

    public static void setStorage(Map <String, Object> storage) {
        if (storage.size ()>0) {
            for (String s : storage.keySet ()) {
                HttpGlobal.storage.put ( s , storage.get ( s ) );
            }
        }
    }

    public static void setStorage(String key , String value) {
        HttpGlobal.storage.put ( key , value);
    }

    public static Map <String, String> getParameters() {
        parameters.put ( "version",getVersion () );
//        parameters.put ( "deliverySysNo",getDeliverySysNo () );
        parameters.put ( "citySysNo",getCitySysNo () );
        parameters.put ( "webSiteSysNo",getWebSiteSysNo () );
        return parameters;
    }

}
